package com.example.mall_system.mapper;

import com.example.mall_system.entity.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ProductMapper {
    List<Product> findAllProducts();
    Product findProductById(@Param("id") Long id);
    List<Product> findProductsByCategory(@Param("category") String category);
    List<Product> findProductsByPage(@Param("start") int start, @Param("size") int size);
    List<Product> findProductsByPageAndKeyword(@Param("start") int start, @Param("size") int size, @Param("keyword") String keyword);
    List<Product> findProductsBySellerId(@Param("sellerId") Long sellerId);
    int insertProduct(Product product);
    int updateProduct(Product product);
    int deleteProduct(@Param("id") Long id);
    int updateStock(@Param("id") Long id, @Param("quantity") Integer quantity);
    int batchDeleteProducts(@Param("productIds") Long[] productIds);
    int countProductsBySellerId(@Param("sellerId") Long sellerId);
}